package thread.threaddemo;

/**
 * @Author: wenjingyuan
 * @Date: 2022/11/11/21:31
 * @Description:执行catch里边的内容
 */
public class ThreadSleep {
    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(()->{
            try {
                Thread.sleep(1000*60*60);
            } catch (InterruptedException e) {
                //e.printStackTrace();
                System.out.println("我接收到了一个终止异常");
            }
        });
        thread.start();
        Thread.sleep(1000);
        System.out.println("终止子线程 thread");
        thread.interrupt();
    }
}
